using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ConsoleApplication2.Models.Mapping
{
    public class so_projectMap : EntityTypeConfiguration<so_project>
    {
        public so_projectMap()
        {
            // Primary Key
            this.HasKey(t => new { t.Project_, t.Description, t.Inactive });

            // Properties
            this.Property(t => t.Project_)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity);

            this.Property(t => t.Description)
                .IsRequired()
                .HasMaxLength(50);

            // Table & Column Mappings
            this.ToTable("so_project");
            this.Property(t => t.Project_).HasColumnName("Project#");
            this.Property(t => t.Description).HasColumnName("Description");
            this.Property(t => t.Inactive).HasColumnName("Inactive");
        }
    }
}
